//package org.jeecg.modules.middleware.quartz.job;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import org.apache.commons.lang.StringUtils;
//import org.jeecg.modules.paycenter.channel.bankdocking.dto.Cmp;
//import org.jeecg.modules.paycenter.channel.bankdocking.dto.RespPacket;
//import org.jeecg.modules.paycenter.channel.bankdocking.utils.BankUtils;
//import org.jeecg.modules.wlhy.bill.entity.HyDriverBill;
//import org.jeecg.modules.wlhy.bill.service.IHyDriverBillService;
//import org.jeecg.modules.wlhy.utils.HyConfigUtils;
//import org.jeecg.modules.wlhy.hyconfig.entity.HyConfig;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
//@Service
//public class PayScheduleService  {
//
//    @Autowired private IHyDriverBillService hyDriverBillService;
//    @Autowired private BankUtils bankUtils;
//
//    private QueryWrapper<HyDriverBill> driverqw = new QueryWrapper<HyDriverBill>();
//
//    public PayScheduleService(){
//        driverqw.eq("bill_type","2").ne("resp_source","0").ne("resp_source","5");
//    }
//
//    //处理司机提现失败
////    @Scheduled(fixedDelay = 1000*60*5)
//    private void driverTxSchedule(){
//        HyConfig config = HyConfigUtils.getConfig();
//        if(!config.getNhbankIzUse()){
//            return;
//        }
//        List<HyDriverBill> list = hyDriverBillService.list(driverqw);
//        if(list != null && list.size() > 0) {
//            for (HyDriverBill driverBill : list) {
//                try {
//                    String lsd = driverBill.getBillNum();
//                    if(StringUtils.isEmpty(lsd)){
//                        driverBill.setRespSource("0");
//                        driverBill.setRespCode("-1");
//                        driverBill.setRespInfo("交易失败");
//                        hyDriverBillService.updateById(driverBill);
//                        continue;
//                    }
//                    RespPacket packet = bankUtils.getExchangeStatus(lsd);
//                    if(packet.isSuccess()){
//                        String transSta = packet.getTransSta();
//                        if("4".equals(transSta)) {
//                            driverBill.setRespSource("0");
//                            driverBill.setRespCode("4");
//                            driverBill.setRespInfo("交易成功");
//                            hyDriverBillService.updateById(driverBill);
//                        }else {
//                            Cmp cmp = packet.getCmp();
//                            String RespInfo = "交易失败";
//                            if(cmp!=null){
//                                RespInfo = cmp.getRespPrvData();
//                            }
//                            driverBill.setRespSource(transSta);
//                            driverBill.setRespCode("");
//                            driverBill.setRespInfo(RespInfo);
//                            hyDriverBillService.updateById(driverBill);
//                        }
//                    }
//                } catch (Exception ex) {
//
//                }
//            }
//        }
//    }
//
//
//
//}
